package com.foreknow.elm.controller;

import com.foreknow.elm.dao.FoodDao;
import com.foreknow.elm.dao.impl.FoodDaoImpl;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.service.FoodService;
import com.foreknow.elm.service.impl.BusinessServiceImpl;
import com.foreknow.elm.service.impl.FoodServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class FoodController {
    /**
     * 请求地址  http://localhost:8080/MavenElmWebProject/FoodController/listFoodByBusinessId?businessId=10002
     * @param request
     * @return
     */
    public Object listFoodByBusinessId(HttpServletRequest request){
        //获取请求参数
        String businessId = request.getParameter("businessId");
        //调用Service层的方法
        FoodService service = new FoodServiceImpl();
        List<Food> list = service.listFoodByBusinessId(Integer.valueOf(Integer.valueOf(businessId)));

        return list;
    }
}
